var a = getApp();

Page({
  data: {
    saidList: [],
    saidList1: [],
    targetindex: 1
  },
  onLoad: function(options) {
    var that = this
    var yishuo = JSON.parse(options.yishuo)
    var u_id = options.u_id
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    that.setData({
      yishuo: yishuo,
      u_id: u_id,
      targetindex: options.targetindex
    })
  },
  DepartmentalDetails(e) {
    console.log(e)
    var h_id = e.currentTarget.dataset.h_id
    var zid = e.currentTarget.dataset.zid
    var yisid = e.currentTarget.dataset.yisid
    var info = JSON.stringify(e.currentTarget.dataset.info)
    var h_leixing = e.currentTarget.dataset.h_leixing
    wx.navigateTo({
      url: '/hyb_yl/backstageServices/pages/DepartmentalDetails/DepartmentalDetails?types=' + e.currentTarget.dataset.types + '&h_id=' + h_id + '&zid=' + zid + '&info=' + info + '&h_leixing=' + h_leixing + '&yisid=' + yisid,
    })
  },
  onReady: function() {},
  onShow: function() {},
  tapFun: function(e) {
    var that = this
    var index = e.currentTarget.dataset.targetindex
    if (index == 2) {
      a.util.request({
        'url': 'entry/wxapp/allyishuo',
        data: {
          op: 'huanjiao',
          u_id: that.data.u_id
        },
        success: function(res) {
          console.log(res)
          that.setData({
            hjlist: res.data.data
          })
        },
      })
    }
    this.setData({
      targetindex: e.currentTarget.dataset.targetindex,
    })
  },
  previewImage: function(a) {
    var t = this;
    var artrs = t.data.saidList;
    var i = a.currentTarget.dataset.index;
    console.log(a);
    wx.previewImage({
      current: a.target.dataset.url,
      urls: artrs[i].contentImg
    });
  },
  nextImage: function(a) {
    var t = this;
    var artrs = t.data.saidList1;
    var i = a.currentTarget.dataset.index;
    console.log(a);
    wx.previewImage({
      current: a.target.dataset.url,
      urls: artrs[i].contentImg
    });
  },


});

var t = wx.createInnerAudioContext ? wx.createInnerAudioContext() : null;